﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class giaovien_TrangGuiYKienPhanHoi : System.Web.UI.Page
{
    SoLienLacDataContext db = new SoLienLacDataContext();
    string matin;
    protected void Page_Load(object sender, EventArgs e)
    {
        matin=Request.QueryString["MaTin"];
        if (!IsPostBack)
        {
            var c = from p in db.YKienPhuHuynhs
                    where p.MaTin == int.Parse(matin)
                    select new { p.HocSinh.TenHS, p.TieuDe, p.NoiDungYKien };
            lblHocSinh.Text = c.First().TenHS;
            txtTieuDe.Text = c.First().TieuDe;
            //FCKeditor2.Value = c.First().NoiDungYKien.ToString() ;
            spNoiDung.InnerHtml = c.First().NoiDungYKien.ToString();
        }
    }
    protected void btnDongY_Click(object sender, EventArgs e)
    {
        YKienPhuHuynh yk = db.YKienPhuHuynhs.SingleOrDefault(p=>p.MaTin==int.Parse(matin));
        yk.NoiDungPhanHoi = FCKeditor1.Value;
        yk.NgayGui = DateTime.Now;
        yk.TrangThaiTraLoi = true;
        db.SubmitChanges();
       Response.Redirect("TrangDanhSachYKien.aspx");
    }
    protected void btnTuChoi_Click(object sender, EventArgs e)
    {
        Response.Redirect("TrangDanhSachYKien.aspx");
    }
}